home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
cad_elec
/
gerbtool.exe
/
DATA.1
/
UTILS.MAC
< prev
next >
Wrap
Text File
|
1995-10-23
|
7KB
|
413 lines
MACRO lyrvis
# This macro prompts the user for a list of layers to change the
# visibility of. Negative layer values indicate a layer should
# be turned OFF, positive values indicate ON.
GetString "Enter layer list", $lyrlist
StrTok $slyr, ",", $lyrlist
REPEAT $$STATUS > 0
StrRead $slyr, "%n", $lyr # convert string into a numeric value
IF $lyr < 0
Calc $mode = 0 # OFF
Calc $lyr = 0 - $lyr # invert
ELSE
Calc $mode = 1 # ON
END
CallMacro "IsValidLayer", $lyr
IF $$STATUS
LAYERN $lyr
Visibility $mode
END
ELSE
StrWrite $msg, "invalid layer: %.0n", $lyr
MessageBox "Problem!", $msg, 0
END
StrTok $slyr, ",", 0
END
Redraw
END
MACRO FixBlankDcodes
#debug 1
MessageBox "FixBlankDcodes", \
"This macro finds all blank dcodes and\nprompts you to correct them.", \
1
StrCpy $tempfile, "_temp_.tmp"
StrSet $apfile, ""
StrSet $shape, ""
Set $dcode = 0
Set $xs = 0
Set $ys = 0
Set $maxlyr = 0
Set $redraw = $$FALSE
IF $$PLATFORM == 1 # MSDOS
Set $listok = $$TRUE
ELSE
IF $$PLATFORM == 3 # WINDOWS
Set $listok = $$FALSE
StrArray $aplists(20) # 20 is arbitrary, increase as needed
END
END
CallMacro "MaxLoadedLayer", $maxlyr
APREPORT
RepFile $tempfile
Layer 0
SortBy "List"
GO
END
FileOpen $fd, $tempfile, "r"
IF $$STATUS
FileRead $fd, "", $line
REPEAT $$STATUS
IF $listok == $$FALSE
StrSub $buf, 1, 20, $line
StrCmp $buf, "Aperture List Legend"
IF $$STATUS == 0
FileRead $fd, "", $line
REPEAT $$STATUS
Calc $apidx = -1
StrRead $line, "%n - %s", $apidx, $apfile
IF $apidx > 0
IF $apidx > 20
STOP "Too many aperture lists..."
END
StrCpy $aplists($apidx), $apfile
Calc $listok = $apidx
FileRead $fd, "", $line
ELSE
Calc $$STATUS = 0
END
END
END
ViewAll
END
StrLoc $line, "?"
IF $$STATUS > 0
IF $$PLATFORM == 1 # MSDOS
StrRead $line, "? %s D%n %s %n x %n", $apfile, $dcode, $shape, $xs, $ys
ELSE
IF $$PLATFORM == 3 # WINDOWS
StrRead $line, "%n D%n ?%s %n x %n", $apidx, $dcode, $shape, $xs, $ys
StrCpy $apfile, $aplists($apidx)
END
END
CallMacro "_GetLayerNo", $maxlyr, $apfile
Calc $lyr = $$STATUS
# Redraw
HILIDCODE
FLASHES $$TRUE
DRAWS $$TRUE
ARCS $$TRUE
DCODE $dcode
LAYER $lyr
GO
END
StrWrite $line, "%.0n items found\nD-Code: %.0n\nShape: %s\nSize: %.4n, %.4n\n\nCorrect this D-Code?", $$STATUS, $dcode, $shape, $xs, $ys
MessageBox "Confirm", $line, 2
IF $$STATUS
GetApInfo $lyr, $dcode, $shp, $xs, $ys, $type, $tool, $toolsize, $legend
CallMacro "_ApNoToShape", $shp, $shape
GetString "Enter new shape", $shape
CallMacro "_ApShapeToNo", $shape, $shp
StrWrite $line, "%.4n,%.4n", $xs, $ys
GetString "Enter new size", $line
Calc $ys = 0.0
StrRead $line, "%n,%n", $xs, $ys
IF $ys == 0.0
Calc $ys = $xs
END
PutApInfo $lyr, $dcode, $shp, $xs, $ys, $type, $tool, $toolsize, $legend
Calc $redraw = $$TRUE
END
HILIDCODE
FLASHES $$FALSE # this should turn off current highlights
DRAWS $$FALSE
ARCS $$FALSE
DCODE 10
LAYER 1
GO
END
Redraw
END
FileRead $fd, "", $line
END
END
IF $redraw
Redraw
END
END
MACRO _GetLayerNo
Set $lyr = 1
REPEAT $lyr <= $1
ActiveLayer $lyr
IF $$STATUS
GetLayer $lyr, $fn, $ln, $ap, $vis, $fc, $dc, $type, \
$pol, $key, $ftype, $lx, $ly, $ux, $uy, $netid
StrCmp $ap, $2
IF $$STATUS == 0
Calc $$STATUS = $lyr
Calc $lyr = $1
END
END
Calc $lyr = $lyr + 1
END
END
MACRO IsValidLayer
IF $$CALLDEPTH == 0
STOP "This macro must be called from another macro..."
END
Calc $$STATUS = $$FALSE
IF $1 > 0
IF $1 <= $$MAXLAYERS
Calc $$STATUS = $$TRUE
END
END
END
MACRO IsLayerVis
IF $$CALLDEPTH == 0
STOP "This macro must be called from another macro..."
END
GetLayer $1, $fn, $ln, $ap, $vis, $fc, $dc, $type, $pol, $key, $ftype,\
$lx, $ly, $ux, $uy, $netid
Calc $$STATUS = $vis
END
MACRO MaxLoadedLayer
IF $$CALLDEPTH == 0
STOP "This macro must be called from another macro..."
END
Set $1 = $$MAXLAYERS + 1
REPEAT $$STATUS == $$FALSE
Calc $1 = $1 - 1
ActiveLayer $1
END
END
MACRO MaxLoadedAp
IF $$CALLDEPTH == 0
STOP "This macro must be called from another macro..."
END
# Set $2 = 4000
Set $2 = 999 # lowered to speed up...
REPEAT $$STATUS == $$FALSE
Calc $2 = $2 - 1
GetApInfo $1, $2, $shp, $xs, $ys, $type, $tool, $toolsize, $legend
END
END
MACRO _ApNoToShape
IF $1 == $$ROUND
StrCpy $2, "Round"
ELSE
IF $1 == $$SQUARE
StrCpy $2, "Square"
ELSE
IF $1 == $$RECTANGLE
StrCpy $2, "Rectangle"
ELSE
IF $1 == $$OBLONG
StrCpy $2, "Oblong"
ELSE
IF $1 == $$OCTAGON
StrCpy $2, "Octagon"
ELSE
IF $1 == $$THERMAL
StrCpy $2, "Thermal"
ELSE
IF $1 == $$THERMAL45
StrCpy $2, "Thermal45"
ELSE
IF $1 == $$TARGET
StrCpy $2, "Target"
ELSE
IF $1 == $$DONUT
StrCpy $2, "Donut"
ELSE
IF $1 == $$DIAMOND
StrCpy $2, "Diamond"
ELSE
IF $1 == $$CUSTOM
StrCpy $2, "Custom"
ELSE
IF $1 == $$COMPLEX
StrCpy $2, "Complex"
END
END
END
END
END
END
END
END
END
END
END
END
END
MACRO _ApShapeToNo
StrSub $shp, 1, 2, $1
StrCmp $shp, "Ro"
IF $$STATUS == 0
Calc $2 = $$ROUND
ELSE
StrCmp $shp, "Sq"
IF $$STATUS == 0
Calc $2 = $$SQUARE
ELSE
StrCmp $shp, "Re"
IF $$STATUS == 0
Calc $2 = $$RECTANGLE
ELSE
StrCmp $shp, "Ob"
IF $$STATUS == 0
Calc $2 = $$OBLONG
ELSE
StrCmp $shp, "Oc"
IF $$STATUS == 0
Calc $2 = $$OCTAGON
ELSE
StrCmp $shp, "TH"
IF $$STATUS == 0
StrLoc $1, "45"
IF $$STATUS > 0
Calc $2 = $$THERMAL45
ELSE
Calc $2 = $$THERMAL
END
ELSE
StrCmp $shp, "Ta"
IF $$STATUS == 0
Calc $2 = $$TARGET
ELSE
StrCmp $shp, "Do"
IF $$STATUS == 0
Calc $2 = $$DONUT
ELSE
StrCmp $shp, "Di"
IF $$STATUS == 0
Calc $2 = $$DIAMOND
ELSE
StrCmp $shp, "Cu"
IF $$STATUS == 0
Calc $2 = $$CUSTOM
ELSE
StrCmp $shp, "Co"
IF $$STATUS == 0
Calc $2 = $$COMPLEX
ELSE
Calc $2 = $$ROUND
END
END
END
END
END
END
END
END
END
END
END
END